﻿@using QDT.Common
@using QDT.Core
@using QDT.Core.Members
@using QDT.Web
@model User
@{
    ViewBag.Title = "用户提现";
    var banks = ViewData["UserBank"] as ICollection<UserBank>;
}
<style type="text/css">
    .ui-carry-ul
    {
        margin-left: 150px;
    }
    .ui-carry-ul li
    {
        line-height: 55px;
    }
    .ui-carry-ul li em
    {
        display: inline-block;
        width: 80px;
    }
    #ui_addbank
    {
        width: 100px;
        border-radius: 4px;
        font-size: 14px;
        border: 1px solid #d52d18;
        color: #d52d18;
        margin-top: 5px;
    }
    
    #ui_addbank:hover
    {
        color: white;
        background-color: #d52d18;
    }
    #Money, #SafePassword
    {
        width: 70px;
    }
</style>
<div class="">
    @Html.Action("_UserBanner")
    <div class="ui-inner">
        <div class="ui-grid-row">
            @Html.Action("UserMenu", new { route = MenuRoute.ChargeCarry })
            <div class="ui-grid-20" style="width: 758px; font-size: 14px;">
                <div class="">
                    <div id="error-div" class="ui-tiptext-container ui-tiptext-container-error hide"
                         style="margin-top: 20px; text-align: center;">
                        <p class="ui-tiptext ui-tiptext-error">
                            <i class="ui-tiptext-icon iconfont" title="出错">&#xf0155;</i> <span style="color: red;"
                                                                                               id="error-info"></span>
                        </p>
                    </div>
                    <div class="ui-table-container">
                        <form id="carry_form" action="@Url.Action("PostMoneyCarry")" method="POST">
                            <div style="height: 140px; width: 100%; border-bottom: 1px solid #d9d9d9; padding-top: 20px;
                                                                                                                                                                                                                                                                                                                                         padding-left: 10px;">
                                <span style="margin-bottom: 10px; font-size: 18px; display: inline-block;">绑定的提现银行卡</span><br />
                                <span style="display: inline-block; margin-bottom: 10px;">持卡人：<span>@Model.RealName</span></span><br />
                                <div class="ui-pay ui-pay-text" style="font-size: 12px;">
                                    @foreach (var userbank in banks)
                                    {
                                        var bank = @Html.F().GetBank(userbank.BankId);
                                        <input type="radio" id="@("UserBank_" + userbank.ID)" name="UserBank" value="@userbank.ID" @(userbank.IsDefault ? "checked" : "")  class="radio-hide"/>
                                        <label for="@("UserBank_" + userbank.ID)">
                                            <li style="background: url(@bank.BigiMage) no-repeat;height: 58px;width: 168px;" name="bank_item" id="@("UserBank_li_" + userbank.ID)" class="@(userbank.IsDefault ? "active" : "")">
                                                <span style="display: inline-block; margin-top: 25px;">
                                                    @userbank.BankCard.ToConfuse(3, 3, 6)
                                                </span><i class="iconfont">&#xe60f;</i></li>
                                        </label>
                                    }
                                    @if (banks.Count < 3)
                                    {
                                        <a href="@Url.Action("BindBankCard")">
                                            <li id="ui_addbank">添加银行卡</li></a>
                                    }
                                </div>
                            </div>
                            <div style="border-bottom: 1px solid #d9d9d9; padding-left: 10px; margin-top: 15px;">
                                <span style="font-size: 18px;">填写提现金额</span>
                                <ul class="ui-carry-ul" style="">
                                    <li><em>可提现额</em> <span style="color: #f39c12">@((Model.UserAccount.CarryAbleMoney).ToMoney())</span>
                                    </li>
                                    <li><em>提现金额</em> <span>
                                                          <input name="Money" id="Money" type="text" class="ui-input ui-input-large" />
                                                          <span class="ui-form-other">元</span> </span></li>
                                    <li style="position: relative;"><em>安全密码</em> <span>
                                                                                      <input name="SafePassword" id="SafePassword" type="password" class="ui-input ui-input-large" />
                                                                                      <span style="font-size: 12px; display: inline-block; position: absolute; top: 30px;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     left: 85px;">您的资金将从第三方支付合作账户转入您的银行卡
                                                                                      </span>
                                                                                      @if (!Model.SafePasswordPassed)
                                                                                      {
                                                                                          <span style="color: red; margin-left: 10px;">您尚未设置安全密码，<a href="@Url.Action("SafePassword")" style="color: red;">点击设置
                                                                                                                                                 </a></span>
                                              
                                                                                      }
                                                                                  </span></li>
                                    <li style="margin-top: 10px;"><em></em><span>
                                                                               <input type="hidden" name="UserId" value="@Model.ID"/>
                                                                               <a style="background-color: #0dba8f" id="carry_submit" href="javascript:;" type="submit"
                                                                                  class="ui-button ui-button-red big"><i class="iconfont">&#xe60e;</i>&nbsp;&nbsp;提现</a>
                                                                           </span></li>
                                </ul>
                            </div>
                        </form>
                    </div>
                </div>
                <div style="padding-left: 10px; margin-top: 20px;">
                    <span style="margin-bottom: 10px; font-size: 18px; display: inline-block;">提现帮助</span><br />
                    <div class="">
                        <p class="ui-tipbox-explain">
                            1、在您申请提现前，请先<a href="@Url.Action("BindBankCard")" style="color:#e74c3c">绑定银行卡</a>；</p>
                        <p class="ui-tipbox-explain">
                            2、不处理当日充值，当日提现；</p>
                        <p class="ui-tipbox-explain">
                            3、在您提出提现申请后当天或下一个工作日（16:00以后提交的下一工作日处理）进行转账操作；</p>
                        <p class="ui-tipbox-explain">
                            4、在双休日和法定节假日期间，用户可申请取现，但银行暂不处理，需要恢复正常上班之后才能处理；</p>
                        <p class="ui-tipbox-explain">
                            5、请您填写详细的开户行支行信息，如果您填写的开户行支行不正确，提现交易将无法成功。如果您不确定开户行支行名称，2.您可以联系银行当地所在的营业网点或者登陆网上银行查询；</p>
                        <p class="ui-tipbox-explain">
                            6、处理您的提现申请后，实际到账时间根据提现银行、地区以及日期（工作日、法定节假日）的不同，到账时间会有所差异，一般到账时间不超过24小时。
                        </p>
                        <p class="ui-tipbox-explain">
                            如有疑问请致电400-009-9594或咨询在线客服。
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div style="margin-top: -10px;">@Html.Partial("_BindBottomImage")</div>
@section Foot{
    <script type="text/javascript">
        $('input[name="UserBank"]').click(function () {
            $('[name="bank_item"]').removeClass('active');
            $("#UserBank_li_"+$(this).val()).addClass('active');
        });
    
        $('#Money').focus(caclMoney).focusout(caclMoney);

        function caclMoney() {
            var money = $('#Money').val();
            if (money == "") {
                $('#carry_money').text('0.00');
            } else {
                $('#carry_money').text(parseFloat(money).toFixed(2));
            }
        }

        $('#carry_submit').click(function () {
            var money = $('#Money').val();
            var safePassword = $('#SafePassword').val();
            var userBank = $('input[name="UserBank"]:checked').val();

            if (money == "") {
                $('#error-div').removeClass('hide');
                $('#error-info').text("请输入提现金额！");
                return;
            }
            if (safePassword == "") {
                $('#error-div').removeClass('hide');
                $('#error-info').text("请输入安全密码！");
                return;
            }
            if (userBank == "") {
                $('#error-div').removeClass('hide');
                $('#error-info').text("请选择提现银行卡！");
                return;
            }
            if (parseFloat(money) > @Model.UserAccount.Money) {
                $('#error-div').removeClass('hide');
                $('#error-info').text("提现金额超过用户余额！");
                return;
            }

            $('#carry_form').submit();

        });
    </script>
}
<script type="text/javascript">
    $().ready(function () {
        $("#ui-kezhuanrang a").addClass("a_class");
        $("#TixianApply").css("background", "#e0524b");
        $("#TixianApply i,#TixianApply span").css("color", "white");
        $("#TixianApply .san-jiaoxing").css("display", "block");
    });
</script>